#include <iostream>
#include <algorithm>
#include <set>
#include <iterator>

using namespace std;

int union_size(set<int> a, set<int> b) {
    set<int> res;
    set_union(a.begin(), a.end(), b.begin(), b.end(), inserter(res, res.begin()));
    int size = res.size();
    return size;
}

int intersection_size(set<int> a, set<int> b) {
    set<int> res;
    set_intersection(a.begin(), a.end(), b.begin(), b.end(), inserter(res, res.begin()));
    int size = res.size();
    return size;
}

int main() {
    set<int> a = {1, 2, 10, 5};
    set<int> b = {10, 3, 1111, 2};
    printf("%d %d\n", union_size(a, b), intersection_size(a, b));
    return 0;
}